package day07;

public class BuyChickens {
    public static void main(String[] args) {
        buy2(100);
    }
    //公鸡5元,母鸡3元,3个小鸡1元
    public static void buy(int totalMoney){
        int cock=0;//公
        int hen=0;//母
        int chick=0;//小
        while (cock*5<=totalMoney){
            while (hen*3<=totalMoney){
                while (chick*3<=totalMoney){
                    if( totalMoney  ==cock*5+hen*3+chick/3){
                        System.out.println(cock);
                        System.out.println(hen);
                        System.out.println(chick);
                    }
                    chick++;
                }
                hen++;
            }
            cock++;
        }
    }
    public static void buy2(int totalMoney){
       //int i=0;//公
        //int j=0;//母
       // int k=0;//小
        for(int i=0;i*5<=totalMoney;i++){
            for(int j=0;j*3<=totalMoney;j++){
                for(int k=0;k*3<=totalMoney;k++){
                    if((totalMoney  ==i*5+j*3+k/3) && k%3==0)
                    System.out.println(i+"\t"+j+"\t"+k);
                }
            }
        }
    }
}
